package com.ktjy.controller;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ktjy.entity.SysUser;
import com.ktjy.service.ISysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class SysUserController {


    @Autowired
    ISysUserService sysUserService;

    @RequestMapping("/user/pagelist")
    public Object getPageList(@RequestParam(defaultValue = "1",name ="pageIndex" ) Integer pageIndex,
                              @RequestParam(defaultValue = "2",name ="pageSize") Integer pageSize,
                              SysUser sysUser){
        IPage<SysUser> page=new Page<SysUser>(pageIndex,pageSize);
        return sysUserService.page(page);
    }



    @RequestMapping("/user/update")
    public Object update(  SysUser sysUser){

        return sysUserService.updateById(sysUser);
    }

    @RequestMapping("/user/del")
    public Object del(  SysUser sysUser){

        return sysUserService.removeById(sysUser);
    }
}
